package com.cgwx.testservice.utils;

import org.springframework.stereotype.Component;

/**
 * @author GaoWei
 * @Date 2021/7/14 - 11:25
 */

@Component
public class FileIconUtils{
    /**
     * 输入文件扩展名，返回相应的图标代码
     */
    public String setFileIconCode(String fileType){
        String fileIconCode;
        switch (fileType){
            case "csv":
            case "CSV":
                fileIconCode = "CSV";
                break;
            case "mp4":
            case "rmvb":
            case "mkv":
                fileIconCode = "VIDEO";
                break;
            case "gif":
                fileIconCode = "GIF";
                break;
            case "txt":
                fileIconCode = "TXT";
                break;
            case "xml":
                fileIconCode = "XML";
                break;
            case "doc":
            case "docx":
            case "DOC":
            case "DOCX":
                fileIconCode = "WORD";
                break;
            case "ppt":
            case "pptx":
            case "PPT":
            case "PPTX":
                fileIconCode = "PPT";
                break;
            case "xls":
            case "xlsx":
            case "XLS":
            case "XLSX":
                fileIconCode = "EXCEL";
                break;
            case "jpg":
            case "JPG":
                fileIconCode = "JPG";
                break;
            case "png":
            case "PNG":
                fileIconCode = "PNG";
                break;
            case "pdf":
            case "PDF":
                fileIconCode = "PDF";
                break;
            case "sql":
            case "SQL":
            case "json":
                fileIconCode = "DATA";
                break;
            case "zip":
            case "ZIP":
                fileIconCode = "ZIP";
                break;
            default:
                fileIconCode = "DEFAULT";
                break;
        }
        return fileIconCode;
    }
}
